package com.jtf.web.link;

import java.net.InetAddress;
import java.net.InterfaceAddress;
import java.net.NetworkInterface;
import java.net.UnknownHostException;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;

public class Test {
    public static void main(String[] args) {
        try {
            Stream<NetworkInterface> networkInterfaceStream = NetworkInterface.networkInterfaces();
            networkInterfaceStream.forEach(t->{
                System.out.println(t.getName());
                List<InterfaceAddress> interfaceAddresses = t.getInterfaceAddresses();
                for (InterfaceAddress interfaceAddress : interfaceAddresses) {
                    System.out.println("1111"+ interfaceAddress.getAddress()+","+interfaceAddress.getNetworkPrefixLength()+","+interfaceAddress.getBroadcast());
                }
                System.out.println("_________________");
            });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
